﻿using System;
using System.Collections.Generic;
using System.Security.Cryptography.X509Certificates;
using System.Text;

namespace HCService.MsgHandler.SubHandler
{
	class ClientRequestRes : HandlerBase
	{
		public new string HandleTag = "Request_Res";
		public ClientRequestRes(PackHandlerCenter center)
		{
			center.RegisterPackHandle(HandleTag, Handle);
		}

		public override void Handle(Client.IClient client, Pack pack)
		{
			if(pack.HandleTag == this.HandleTag)
			{
				string userName = Encoding.UTF8.GetString(pack.PackBuffer);
				Proto.Event.Res ret = new Proto.Event.Res();
				ret.Status = Proto.Event.EventStatus.Ok;
				ret.User = new Proto.Entity.User() {
					UserName = userName,
					Identity = 1234542,
					LoginTime = "2020/7/29",
					BindPhone = "+86 1312253322"
				};
				ret.User.Characters.Add(101);
				ret.User.Characters.Add(102);
				Console.WriteLine(pack.ToStringBuff());
				client.Send(HandleTag, ret);
			}
		}
	}
}
